package cn.wizzer.app.web.modules.controllers.platform.user.account;

import cn.wizzer.app.user.modules.services.account.UserAccountRecordStatisticsService;
import cn.wizzer.framework.base.Result;
import com.alibaba.dubbo.config.annotation.Reference;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.mvc.annotation.At;
import org.nutz.mvc.annotation.Ok;
import org.nutz.mvc.annotation.Param;

import javax.servlet.http.HttpServletRequest;

/**
 * @author zl
 * @date 2020/6/17 15:51
 */
@IocBean
@At("/platform/user/account/statistics")
public class AccountStatisticsController {

    @Inject
    @Reference
    private UserAccountRecordStatisticsService statisticsService;


    @At("")
    @Ok("beetl:/platform/user/statistics/account/index.html")
    @RequiresPermissions("user.statistics.account")
    public void index(HttpServletRequest req) {

    }

    @At
    @Ok("json")
    @RequiresPermissions("user.statistics.account")
    public Object data(@Param("searchKeyword") String searchKeyword,
                       @Param("searchDate") String[] searchDate,
                       @Param("pageOrderName") String pageOrderName,
                       @Param("pageOrderBy") String pageOrderBy,
                       int pageNumber, int pageSize) {
        return Result.success().addData(statisticsService.listPage(searchKeyword, searchDate, pageOrderName, pageOrderBy, pageNumber, pageSize));
    }

}
